snippet import_ohos "import build/ohos" b
import("//build/ohos.gni")${0}
endsnippet

snippet so_ohos "ohos_shared_library" b
## Build ${1}.so {{{${0}
config("${1}_config") {
  visibility = [ ":*" ]

  include_dirs = [
  ]

  cflags = [
    "-Wall",
    "-Werror",
    "-g3",
  ]
}

config("${1}_public_config") {
  include_dirs = [
  ]
}

ohos_shared_library("${1}") {
  sources = [
  ]

  configs = [
    ":${1}_config",
  ]

  public_configs = [
    ":${1}_public_config",
  ]

  deps = [
  ]

  public_deps = [
  ]

  subsystem_name = "${2}"
}
## Build ${1}.so }}}
endsnippet

snippet exe_ohos "ohos_executable" b
## Build ${1} {{{${0}
config("${1}_config") {
  visibility = [ ":*" ]

  include_dirs = [
  ]

  cflags = [
    "-Wall",
    "-Werror",
    "-g3",
  ]
}

ohos_executable("${1}") {
  install_enable = ${2}

  sources = [
  ]

  configs = [
    ":${1}_config",
  ]

  deps = [
  ]

  subsystem_name = "${3}"
}
## Build ${1} }}}
endsnippet

snippet a_ohos "ohos_static_library" b
## Build ${1}.a {{{${0}
config("${1}_config") {
  visibility = [ ":*" ]

  include_dirs = [
  ]

  cflags = [
    "-Wall",
    "-Werror",
    "-g3",
  ]
}

config("${1}_public_config") {
  include_dirs = [
  ]
}

ohos_static_library("${1}") {
  sources = [
  ]

  configs = [
    ":${1}_config",
  ]

  public_configs = [
    ":${1}_public_config",
  ]

  deps = [
  ]

  public_deps = [
  ]
}
## Build ${1}.a }}}
endsnippet

snippet conf "config" b
config("${1}") {
  include_dirs = [
  ]

  cflags = [
  ]
}
endsnippet

snippet etc_ohos "ohos_prebuilt_etc" b
## Install ${2}${1} to /system/etc/${5:.}/${1} {{{
ohos_prebuilt_etc("${1}") {
  source = "${2}${1}"
  relative_install_dir = "${5}"
  subsystem_name = "${3}"
}
## Install ${2}${1} to /system/etc/${5}/${1} }}}
endsnippet

snippet ut_ohos "ohos_unittest" b
## UnitTest ${1} {{{
ohos_unittest("${1}") {
  module_out_path = "${2}"

  sources = [
  ]

  cflags = [
    "-Wall",
    "-Werror",
    "-g3",
  ]

  deps = [
  ]
}
## UnitTest ${1} }}}
endsnippet

snippet sooption_ohos "shared library option" b
  output_prefix_override=true
  output_name=""
  output_extension="so"
endsnippet

snippet exe "executable" b
## Build ${1} {{{${0}
config("${1}_config") {
  visibility = [ ":${1}" ]

  include_dirs = [
  ]

  cflags = [
    "-Wall",
    "-Werror",
    "-g3",
  ]
}

executable("${1}") {
  sources = [
  ]

  configs = [
    ":${1}_config",
  ]

  deps = [
  ]
}
## Build ${1} }}}
endsnippet

snippet so "shared_library" b
## Build ${1}.so {{{${0}
config("${1}_config") {
  visibility = [ ":${1}" ]

  include_dirs = [
  ]

  cflags = [
    "-Wall",
    "-Werror",
    "-g3",
  ]
}

config("${1}_public_config") {
  include_dirs = [
  ]
}

shared_library("${1}") {
  sources = [
  ]

  configs = [
    ":${1}_config",
  ]

  public_configs = [
    ":${1}_public_config",
  ]

  deps = [
  ]

  public_deps = [
  ]
}
## Build ${1}.so }}}
endsnippet

snippet mg "mingw_group" b
group("${1}") {
  if (current_os == "mingw") {
    public_deps = [ ":${1}_mingw" ]
  } else {
    public_deps = [ ":${1}_ohos" ]
  }
}
endsnippet
